<?php
/**
 * 商户总店模型
 * Created by Sublime Text 3.
 * @authors Rejeo (rejeo@qq.com)
 * @date    2018-04-25 16:34:32
 */
namespace app\common\model;

use app\common\model\BaseModel;

class BisLocation extends BaseModel
{
    // 通过status来获取商家数据
    public function getLocatByStatus($status=0)
    {
        $data = [
            // 'status' => ['>=',$status],
            'status' => $status,
            // 'is_main' => $is_main,
        ];
        $order = [
            'id' => 'desc',
        ];
        $field = [
            'id','name','status','is_main','create_time',
        ];
        $res = $this->where($data)->field($field)->paginate();
        return $res;
    }

    // 根据id获取相关的商户信息
    public function getNormalLocatByBisId($bisId=0)
    {
        if (0===$bisId) {
            return FALSE;
        }
        $data = [
            // 'status' => ['>=',$status],
            'status' => 1,
            'bis_id' => $bisId,
        ];
        $order = [
            'id' => 'desc',
        ];
        $field = [
            'id','name',
        ];
        $res = $this->where($data)->field($field)->select();
        return $res;
    }

    public function getNormalLocationsInId($ids)
    {
        $data = [
            'id' => ['in', $ids],
            'status' => 1
        ];

        return $this->where($data)->select();
    }
}

